package org.scauinfo.fpos.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Member entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "member", catalog = "db_fpos")
public class Member implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer id;
	private Memberpermission memberpermission;
	private String memberId;
	private String name;
	private String gender;
	private String telephone;
	private String address;
	private Set<Saleorder> saleorders = new HashSet<Saleorder>(0);

	// Constructors

	/** default constructor */
	public Member() {
	}

	/** minimal constructor */
	public Member(String memberId, String name) {
		this.memberId = memberId;
		this.name = name;
	}

	/** full constructor */
	public Member(Memberpermission memberpermission, String memberId,
			String name, String gender, String telephone, String address,
			Set<Saleorder> saleorders) {
		this.memberpermission = memberpermission;
		this.memberId = memberId;
		this.name = name;
		this.gender = gender;
		this.telephone = telephone;
		this.address = address;
		this.saleorders = saleorders;
	}

	/**
	 * @param permission
	 */
	public Member(Memberpermission permission) {
		this.memberpermission = permission;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "permission_id", referencedColumnName = "mpermission_id")
	public Memberpermission getMemberpermission() {
		return this.memberpermission;
	}

	public void setMemberpermission(Memberpermission memberpermission) {
		this.memberpermission = memberpermission;
	}

	@Column(name = "member_id", nullable = false)
	public String getMemberId() {
		return this.memberId;
	}

	public void setMemberId(String memberId) {
		this.memberId = memberId;
	}

	@Column(name = "name", nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "gender")
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Column(name = "telephone")
	public String getTelephone() {
		return this.telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@Column(name = "address")
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<Saleorder> getSaleorders() {
		return this.saleorders;
	}

	public void setSaleorders(Set<Saleorder> saleorders) {
		this.saleorders = saleorders;
	}

}